// app.js
App({
  onLaunch: function() {
    wx.BaaS = requirePlugin('sdkPlugin')
    //让插件帮助完成登录、支付等功能
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        console.log(res)
      }
    })
    wx.BaaS.wxExtend(wx.login,
      wx.getUserInfo,
      wx.requestPayment)

    wx.BaaS.init('81cf9e9bd235aab0b7c1')
    // 微信用户登录小程序
    wx.BaaS.auth.loginWithWechat().then(user => {
      // 登录成功
      console.log(user)
      this.globalData.user = user
    }, err => {
      // 登录失败
    }) // 静默登录
  
  },
  globalData: {
    color: [
      "bg-green", "bg-red", "bg-grey", "bg-blue", "bg-cyan", "bg-yellow"
    ],

    colors: [
      "bg-green", "bg-red", "bg-blue", "bg-cyan", "bg-yellow", "bg-purple"
    ],
    tab: [
      "", "text-red cuIcon-attentionforbidfill", "cur cuIcon-noticefill", "text-grey cuIcon-evaluate_fill", "text-blue"
    ],
    user:{}
  }
})
